import matplotlib.pyplot as plt
import pandas as pd
df=pd.read_excel('学生各学期成绩表.xlsx')
plt.rcParams['figure.figsize']=(10,6)
plt.figure(figsize=(10,8))
x=df['序号']
y=df['语文']
v=df['数学']
z=df['英语']
m=df['综合']
plt.rcParams['font.sans-serif']='SimHei'
plt.title('学生各学期成绩分析')
plt.xlabel('学期')
plt.ylabel('成绩')


plt.subplot(2,2,1)
for a,b in zip(df['序号'],df['语文']):
    plt.text(a,b,'%.1f' % b,ha='center')
plt.grid(axis='y')
plt.xticks(range(11), df['学期'], rotation=15)
plt.plot(x, y)
plt.legend(('语文',))
plt.show()


plt.subplot(2,2,2)
for a,b in zip(df['序号'],df['数学']):
    plt.text(a,b,'%.1f' % b,ha='center')
plt.grid(axis='v')
plt.xticks(range(11), df['学期'], rotation=15)
plt.plot(x, y)
plt.legend(('数学',))
plt.show()

plt.subplot(2,2,3)
for a,b in zip(df['序号'],df['英语']):
    plt.text(a,b,'%.1f' % b,ha='center')
plt.grid(axis='z')
plt.xticks(range(11), df['学期'], rotation=15)
plt.plot(x, y)
plt.legend(('英语',))
plt.show()

plt.subplot(2,2,1)
for a,b in zip(df['序号'],df['综合']):
    plt.text(a,b,'%.1f' % b,ha='center')
plt.grid(axis='x')
plt.xticks(range(11), df['学期'], rotation=15)
plt.plot(x, y)
plt.legend(('综合',))
plt.show()








